package edu.pku.hawk.controller.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class SerResourceList implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3343078021790569501L;
	
	public List<SerResource> ResourceList = new ArrayList<SerResource>();
	
	private String cjName;
	private double totalCpu;
	private double totalDisk;
	private double totalMem;
	private double totalNet;
	
	private String xenName;
	private String xenIP;
	private String vmName;
	private String vmIP;

	private boolean enable;

	public SerResourceList() {
		
	}
	
	public SerResourceList(HashMap<Integer,SerResource> map) {
		Iterator<Map.Entry<Integer,SerResource>> it = map.entrySet().iterator();
		while (it.hasNext()) {
			SerResource sr = it.next().getValue();
			ResourceList.add(sr);
			totalCpu +=sr.getCpu();
			totalDisk +=sr.getDisk();
			totalMem += sr.getMem();
			totalNet += sr.getNet();
		}
	}

	public String getCjName() {
		return cjName;
	}

	public void setCjName(String cjName) {
		this.cjName = cjName;
	}

	public double getTotalCpu() {
		return totalCpu;
	}

	public void setTotalCpu(double totalCpu) {
		this.totalCpu = totalCpu;
	}

	public double getTotalDisk() {
		return totalDisk;
	}

	public void setTotalDisk(double totalDisk) {
		this.totalDisk = totalDisk;
	}

	public double getTotalMem() {
		return totalMem;
	}

	public void setTotalMem(double totalMem) {
		this.totalMem = totalMem;
	}

	public double getTotalNet() {
		return totalNet;
	}

	public void setTotalNet(double totalNet) {
		this.totalNet = totalNet;
	}
	

	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}
	

	public String getXenName() {
		return xenName;
	}

	public void setXenName(String xenName) {
		this.xenName = xenName;
	}

	public String getVmName() {
		return vmName;
	}

	public void setVmName(String vmName) {
		this.vmName = vmName;
	}

	public String getXenIP() {
		return xenIP;
	}

	public void setXenIP(String xenIP) {
		this.xenIP = xenIP;
	}

	public String getVmIP() {
		return vmIP;
	}

	public void setVmIP(String vmIP) {
		this.vmIP = vmIP;
	}
}
